-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Fix export import conflicts for llvm #147600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix export import conflicts for llvm #147600
Conversation
r? @nnethercote rustbot has assigned @nnethercote. Use |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
When you're satisfied that PR CI checks have succeeded, please squash any “fixup” commits into the main commit/commits, to make review easier and keep history simple. |
239f780
to
b678202
Compare
Done |
|
|
||
let llfn = if let Some(llfn) = cx.get_declared_value(sym) { | ||
let llfn = if let Some(llfn) = cx.get_declared_value(sym) | ||
&& (!cx.tcx.is_codegened_item(instance.def_id()) || !instance.def_id().is_local()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break things badly. With this change every time you refer to a different raw-dylib import of the same function, LLVM will use a different name for the function in the object file. For example open
, open.1
, open.2
, ... Only the first reference will actually be resolved by the import library. Also in the case of #113050 where someone defines a local function with the same name, if this function is declared first, then the raw-dylib import get the mangled name and if it is declared second, then if another codegen unit tries to call this function it will call the raw-dylib instead.
The only fix for #113050 I can think of is to have rustc mangle raw-dylib imports and also record this mangled name in the import library rustc generates. The issue with that however is that when a user does want to override a raw-dylib import, they can't do that anymore either.
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
1512b63
to
199cb74
Compare
Squashed again. I'll research this and reply when I have a solution. |
Trying to fix #113050 for #110489 so I can make Windows easier to set up.